package com.world.rickcloudendpoint.config;

import com.world.rickcloudendpoint.common.enums.KafkaConsumerMode;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.bind.DefaultValue;
import org.springframework.context.annotation.Configuration;

/**
 * @description: kafka消费者配置项
 * @author: jlsong
 * @date: 2022/03/13 20:43:50
 * @version: 1.0
 */
@Configuration
public class KafkaConsumerConfig {

    @Value("${SOURCE_KAFKA_ASYNC_COMMIT_ENABLE:true}")
    boolean isSourceKafkaAsyncCommitEnable;

    @Value("${SOURCE_KAFKA_COMMIT_ONLY_CURRENT_PARTITIONS_ENABLE:true}")
    boolean isSourceKafkaCommitOnlyCurrentPartitionsEnable;

    @Value("${SOURCE_KAFKA_TOPIC}")
    String getSourceKafkaTopic;

    @Value("${SOURCE_KAFKA_BROKERS}")
    String getSourceKafkaBrokers;

    @Value("${SOURCE_KAFKA_CONSUMER_GROUP_ID}")
    String getSourceKafkaConsumerGroupId;

    @Value("${SOURCE_KAFKA_CONSUMER_CONFIG_AUTO_COMMIT_ENABLE:false}")
    boolean isSourceKafkaConsumerConfigAutoCommitEnable;

    @Value("${SOURCE_KAFKA_CONSUMER_CONFIG_METADATA_MAX_AGE_MS:500}")
    int getSourceKafkaConsumerConfigMetadataMaxAgeMs;

    @Value("${SOURCE_KAFKA_CONSUMER_CONFIG_MAX_POLL_RECORDS:500}")
    int getSourceKafkaConsumerConfigMaxPollRecords;

    @Value("${SOURCE_KAFKA_CONSUMER_CONFIG_SESSION_TIMEOUT_MS:10000}")
    int getSourceKafkaConsumerConfigSessionTimeoutMs;

    @Value("${SOURCE_KAFKA_POLL_TIMEOUT_MS:9223372036854775807}")
    Long getSourceKafkaPollTimeoutMs;

    @Value("${SOURCE_KAFKA_CONSUMER_MODE:SYNC}")
    KafkaConsumerMode getSourceKafkaConsumerMode;
}
